package o;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import com.huawei.hmf.annotation.ApiDefine;
import com.huawei.secure.android.common.intent.SafeIntent;

@ApiDefine(uri = cnv.class)
public class com implements cnv {
    public void ˏ(Context context, Intent intent, int i) {
        SafeIntent safeIntent = new SafeIntent(intent);
        if (i == 0) {
            ˏ(context, safeIntent);
        } else if (i == 1) {
            ॱ(context, safeIntent);
        }
    }

    private void ॱ(Context context, SafeIntent safeIntent) {
        Uri data = safeIntent.getData();
        if (data != null) {
            String schemeSpecificPart = data.getSchemeSpecificPart();
            if (!TextUtils.isEmpty(schemeSpecificPart)) {
                String action = safeIntent.getAction();
                if ("android.intent.action.PACKAGE_ADDED".equals(action)) {
                    cpp.ˏ(context, schemeSpecificPart, 1, 0, 2, false);
                } else if ("android.intent.action.PACKAGE_REMOVED".equals(action) && !safeIntent.getBooleanExtra("android.intent.extra.REPLACING", false)) {
                    cpu.ॱ(context, schemeSpecificPart, 1, 0, 2);
                }
            }
        }
    }

    private void ˏ(Context context, SafeIntent safeIntent) {
        if ("android.intent.action.PACKAGE_ADDED".equals(safeIntent.getAction())) {
            Uri data = safeIntent.getData();
            if (data != null) {
                Object schemeSpecificPart = data.getSchemeSpecificPart();
                if (!TextUtils.isEmpty(schemeSpecificPart)) {
                    cpm.ˊ(context, schemeSpecificPart);
                }
            }
        }
    }
}
